#if !defined(AFX_UICONTAINER_H__20060218_C077_501B_DC6B_0080AD509054__INCLUDED_)
#define AFX_UICONTAINER_H__20060218_C077_501B_DC6B_0080AD509054__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

/////////////////////////////////////////////////////////////////////////////////////
//

class IContainerUI {
public:
   virtual bool Add(CControlUI* pControl) = 0;
   virtual bool Remove(CControlUI* pControl) = 0;
   virtual void RemoveAll() = 0;
};

/////////////////////////////////////////////////////////////////////////////////////
//

class UILIB_API CContainerUI : public CControlUI, public IContainerUI {
public:
   CContainerUI();
   virtual ~CContainerUI();

public:
   LPCTSTR GetClass() const;
   LPVOID GetInterface(LPCTSTR pstrName);

   bool Add(CControlUI* pControl);
   bool Remove(CControlUI* pControl);
   void RemoveAll();

   void Event(TEventUI& event);

   virtual void SetPadding(int iPadding);
   virtual void SetWidth(int cx);
   virtual void SetHeight(int cy);
   virtual void SetAutoDestroy(bool bAuto);

   void SetPos(RECT rc);
   void DoPaint(HDC hDC, const RECT& rcPaint);

   void SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue);

   void SetManager(CPaintManagerUI* pManager, CControlUI* pParent);
   CControlUI* FindControl(FINDCONTROLPROC Proc, LPVOID pData, UINT uFlags);

protected:
   CStdPtrArray m_items;
   RECT m_rcInset;
   int m_iPadding;
   SIZE m_cxyFixed;
   bool m_bAutoDestroy;
   HWND m_hwndScroll;
   int m_iScrollPos;
};

/////////////////////////////////////////////////////////////////////////////////////
//

class UILIB_API CDialogLayoutUI : public CContainerUI {
public:
   CDialogLayoutUI();

   LPCTSTR GetClass() const;
   LPVOID GetInterface(LPCTSTR pstrName);

   void SetPos(RECT rc);

// protected:
   // void RecalcArea();

protected:  
   typedef struct {
      CControlUI* pControl;
      UINT uMode;
      RECT rcItem;
   } STRETCHMODE;

   RECT m_rcDialog;
   RECT m_rcOriginal;
   bool m_bFirstResize;
   CStdValArray m_aModes;
};

#endif // !defined(AFX_UICONTAINER_H__20060218_C077_501B_DC6B_0080AD509054__INCLUDED_)
